Thread Warum beschreibt er TXT Datei nicht?: TXT Datei aber neue Zeit (1 answers)
Opened by Alex556 at 2005-02-15 21:19

Alex556
 2005-02-15 21:19
#4414 #4414
User since
2005-02-04
2 Artikel
BenutzerIn
[default_avatar]
Hallo,

habe mir ein Gästebuch als ein Eingabescript umgeschrieben.
Mein Problem ist nun das er die Datei xxentry nicht beschreibt.
Die bleibt leer.

xxentry.txt probiert mit 666 und 777 CHMOD (0 Bytest)
reg.cgi 755 CHMOD
add.htm zum eingeben etwas weiter unten.

Er schreibt zwar Thank you aber es geht nicht.
Die Datei xxentry.txt hat aber auch das Speicher Datum und Zeit. Wird geändert.

??? sind auch die richtigen Pfade


Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
#!/usr/bin/perl

$directory_gbook = "/home/???/xxentry.txt";
$guestbook = "http://???/xxentry.txt";
$cgi = "http://www.???/reg.cgi";
$base = "http://www.???/add.htm";
$gif1 = "add.gif";
$gif2 = "miss.gif";
$gif3 = "thanks.gif";
$gif4 = "blueline.gif";

$mail = 0;
$mailto = 'support@???';

############################################################
#Don't touch, these are necessary to run the script!
$mailprog = '/usr/lib/sendmail';
$entry = 1;
$allow = 1;
$date_command = "/usr/bin/date";
############################################################
$date = `$date_command +"%B %d, %Y"`; chop($date);

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
  ($name, $value) = split(/=/, $pair);
  $value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $value =~ s/<!--(.|\n)*-->//g;

  if ($allow != 1) {
     $value =~ s/<([^>]|\n)*>//g;
  }

  $FORM{$name} = $value;
}

########
#Checks to see that the comments, name and e-mail address were added!
#&no_comments unless $FORM{'comments'};
#&no_name unless $FORM{'name'};
#&no_email unless $FORM{'email'};

######
#Checks to see if the E-mail address is in the normal form,
#yourname@yourcompany.com

#if (&email_check($FORM{'email'})) {
#}
#else {
#&no_email;
#}

#######
#Opens 'shopentry.html' for writting
open (FILE,"$directory_gbook") || die "Can't Open $directory_gbook: $!\n";
@LINES=<FILE>;
close(FILE);
$SIZE=@LINES;

# Open Link File to Output
open (GUEST,">$directory_gbook") || die "Can't Open $directory_gbook: $!\n";

for ($i=0;$i<=$SIZE;$i++) {
  $_=$LINES[$i];
  if (/<!--add-->/) {
     if ($entry eq '1') {
        print GUEST "<!--add-->\n";
     }
        print GUEST "<TABLE CELLPADDING=0 CELLSPACING=1 BORDER=0>\n";
     if ( $FORM{'150'}) {
        print GUEST "<TR><TD><B>150</B></TD>  <TD>$FORM{'150'}</TD></TR>\n";
        }
     if ($FORM{'152'}) {
        print GUEST "<TR><TD><B>152</B></TD> <TD>$FORM{'152'}</TD></TR>\n";
     }
     if ($FORM{'151'}) {
        print GUEST "<TR><TD><B>151</B></TD> <TD>$FORM{'151'}</TD></TR>\n";
     }
     if ($FORM{'1100'}) {
        print GUEST "<TR><TD><B>1100</B></TD> <TD>$FORM{'1100'}</TD></TR>\n";
     }








#      if ($FORM{'151'} ne "http://") {
#         print GUEST "<TR><TD><B>My URL:</B></TD> <TD><A HREF=$FORM{'url'}>$FORM{'url'}</A></TD></TR>\n";
#      }
#      else {
#      }
#      if ( $FORM{'city'} ){
#         print GUEST "<TR><TD><B>Location: </B></TD> <TD>$FORM{'city'}";
#         print GUEST ", $FORM{'state'}     $FORM{'country'}</TD></TR>\n";
#      }
     print GUEST "<TR><TD VALIGN=top><B>Comments:  </B></TD> \n";
     print GUEST "<TD>$FORM{'comments'}</TD></TR></TABLE><P>\n\n\n\n";
     print GUEST "<CENTER><IMG SRC=\"$base$gif4\"></CENTER><BR>\n\n\n";
     if ($entry eq '0') {
        print GUEST "<!--add->\n";
     }
  }
  else {
     print GUEST $_;
  }
}
close (GUEST);

#########
# Mail Option
if ($mail eq '1') {
  open (MAIL, "|$mailprog $mailto") || die "Can't open $mailprog!\n";
  print MAIL "Reply-to: $FORM{'email'} ($FORM{'name'})\n";
  print MAIL "From: $FORM{'email'} ($FORM{'name'})\n";
  print MAIL "Subject: Bestellung\n\n";
  print MAIL "$FORM{'name'} <$FORM{'email'}> has made an entry to your guestbook!\n";
  print MAIL "  - $date\n";
  close (MAIL);
}

##############
# Print Thank You HTML
  print "Content-Type: text/html\n\n";
  print "<HTML>\n";
  print "<TITLE>Thank You</TITLE>\n";
  print "<BODY BGCOLOR=#FFFFFF>\n";
  print "<CENTER></CENTER><BR>\n";
  print "Thank you";
     print "<CENTER></CENTER><BR><BR>\n";
     print "</body></html>\n";
     exit;


#######################
# Subroutines
sub no_name {
  print "Content-type: text/html\n\n";
  print "<HTML>\n";
  print "<TITLE>No Name</TITLE>\n";
  print "<BODY BGCOLOR=#FFFFFF>\n";
  print "<CENTER><IMG SRC=\"$base$gif2\"></CENTER><BR>\n";
  print "You forgot to fill in your Name. We need this in order to\n";
  print "process your entry. Please add your name in the blank below.<p>\n";
  print "<TABLE  CELLSPACING=3 CELLPADDING=2>\n";
  print "<FORM METHOD=POST ACTION=\"$cgi\">\n";
  print "<TR><TD><B>Name:</B></TD><TD><INPUT TYPE=TEXT NAME=\"name\" ";
  print "SIZE=50></TD></TR>\n";
  print "<TR><TD><B>E-Mail:</B></TD><TD><INPUT TYPE=TEXT NAME=\"email\" ";
  print "VALUE=\"$FORM{'email'}\" SIZE=50></TD></TR>\n";
  print "<TR><TD><B>URL:</B></TD><TD><INPUT TYPE=TEXT NAME=\"url\" ";
  print "VALUE=\"$FORM{'url'}\" SIZE=50></TD></TR>\n";
  print "<TR><TD><B>City:</B></TD><TD><INPUT TYPE=TEXT NAME=\"city\" ";
  print "VALUE=\"$FORM{'city'}\" SIZE=15>\n";
  print "           ";
  print "<B>State:</B><INPUT TYPE=TEXT NAME=\"state\" value=\"$FORM{'state'}\" ";
  print "size=2>       <B>Country:</B> ";
  print "<INPUT TYPE=TEXT NAME=\"country\" VALUE=\"$FORM{'country'}\" SIZE=10></TR>\n";
  print "<TR><TD><B>Comments:</B></TD><TD>Comments are stored and saved";
  print "<INPUT TYPE=HIDDEN NAME=\"comments\" ";
  print "VALUE=\"$FORM{'comments'}\"></TD></TR>\n";
  print "<TR><TD>  </TD><TD></TD></TR>\n";
  print "<TR><TD></TD><TD><INPUT TYPE=IMAGE SRC=\"$base$gif1\" BORDER=NO></TD></TR>\n";
  print "</TABLE>\n";
  print "</FORM>\n";
  print "</BODY></HTML>\n";  
  exit;
}

sub no_email {
  print "Content-type: text/html\n\n";
  print "<HTML>\n";
  print "<TITLE>No E-Mail</TITLE>\n";
  print "<BODY BGCOLOR=#FFFFFF>\n";
  print "<CENTER><IMG SRC=\"$base$gif2\"></CENTER><BR>\n";
  print "You forgot to fill in your E-mail address or the e-mail addres you added\n";
  print "is invalid. We need this in order to\n";
  print "process your entry. Please add your E-mail in the blank below.<p>\n";
  print "<TABLE  CELLSPACING=3 CELLPADDING=2>\n";
  print "<FORM METHOD=POST ACTION=\"$cgi\">\n";
  print "<TR><TD><B>Name:</B></TD><TD><INPUT TYPE=TEXT NAME=\"name\" VALUE=\"$FORM{'name'}\" ";
  print "SIZE=50></TD></TR>\n";
  print "<TR><TD><B>E-Mail:</B></TD><TD><INPUT TYPE=TEXT NAME=\"email\" ";
  print "VALUE=\"$FORM{'email'}\" SIZE=50></TD></TR>\n";
  print "<TR><TD><B>URL:</B></TD><TD><INPUT TYPE=TEXT NAME=\"url\" ";
  print "VALUE=\"$FORM{'url'}\" SIZE=50></TD></TR>\n";
  print "<TR><TD><B>City:</B></TD><TD><INPUT TYPE=TEXT NAME=\"city\" ";
  print "VALUE=\"$FORM{'city'}\" SIZE=15>\n";
  print "           ";
  print "<B>State:</B><INPUT TYPE=TEXT NAME=\"state\" value=\"$FORM{'state'}\" ";
  print "size=2>       <B>Country:</B> ";
  print "<INPUT TYPE=TEXT NAME=\"country\" VALUE=\"$FORM{'country'}\" SIZE=10></TR>\n";
  print "<TR><TD><B>Comments:</B></TD><TD>Comments are stored and saved";
  print "<INPUT TYPE=HIDDEN NAME=\"comments\" ";
  print "VALUE=\"$FORM{'comments'}\"></TD></TR>\n";
  print "<TR><TD>  </TD><TD></TD></TR>\n";
  print "<TR><TD></TD><TD><INPUT TYPE=IMAGE SRC=\"$base$gif1\" BORDER=NO></TD></TR>\n";
  print "</TABLE>\n";
  print "</FORM>\n";
  print "</BODY></HTML>\n";  
  exit;
}

sub no_comments {
  print "Content-type: text/html\n\n";
  print "<HTML>\n";
  print "<TITLE>No Comments</TITLE>\n";
  print "<BODY BGCOLOR=#FFFFFF>\n";
  print "<CENTER><IMG SRC=\"$base$gif2\"></CENTER><BR>\n";
  print "You forgot to fill in your Comment. We need this in order to\n";
  print "process your entry. Please add a comment in the blank below.<p>\n";
  print "<TABLE CELLSPACING=3 CELLPADDING=2>\n";
  print "<FORM METHOD=POST ACTION=\"$cgi\">\n";
  print "<TR><TD><B>Name:</B></TD><TD><INPUT TYPE=TEXT NAME=\"name\" ";
  print "VALUE=\"$FORM{'name'}\" SIZE=50></TD></TR>\n";
  print "<TR><TD><B>E-Mail:</B></TD><TD><INPUT TYPE=TEXT NAME=\"email\" ";
  print "VALUE=\"$FORM{'email'}\" SIZE=50></TD></TR>\n";
  print "<TR><TD><B>URL:</B></TD><TD><INPUT TYPE=TEXT NAME=\"url\" ";
  print "VALUE=\"$FORM{'url'}\" SIZE=50></TD></TR>\n";
  print "<TR><TD><B>City:</B></TD><TD><INPUT TYPE=TEXT NAME=\"city\" ";
  print "VALUE=\"$FORM{'city'}\" SIZE=15>\n";
  print "           ";
  print "<B>State:</B><INPUT TYPE=TEXT NAME=\"state\" value=\"$FORM{'state'}\" ";
  print "size=2>       <B>Country:</B> ";
  print "<INPUT TYPE=TEXT NAME=\"country\" VALUE=\"$FORM{'country'}\" SIZE=10></TR>\n";
  print "<TR><TD><B>Comments:</B></TD><TD><TEXTAREA NAME=\"comments\" ";
  print "COLS=50 ROWS=7></TEXTAREA><p>\n";
  print "<TR><TD>  </TD><TD></TD></TR>\n";
  print "<TR><TD></TD><TD><INPUT TYPE=IMAGE SRC=\"$base$gif1\" BORDER=NO></TD></TR>\n";
  print "</TABLE>\n";
  print "</FORM>\n";
  print "\n</BODY></HTML>\n";  
  exit;
}

sub email_check {
   local($emails) = $_[0];

   if ($emails =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(\.$)/ ||
       ($emails !~ /^.+\@localhost$/ &&
        $emails !~ /^.+\@\[?(\w|[-.])+\.[a-zA-Z]{2,3}|[0-9]{1,3}\]?$/)) {
       return(0);
   }
   
   else {
       return(1);
   }
}
1;


add.htm

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Free Register WinHKI</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<div align="center"><strong><font size="+2"></font></strong>
 - <a href="[URL=http://www.]http://www."[/URL] target="_blank">www.</a><br>
 <br>
 + Anonym<br>
 + Newsletter<br>
 + Member Area<br>
 + Free Support<br>
 + Informations<br>
 + and more...<br>
 <br>
 <table width="56%" border="0">
   <FORM METHOD="POST" ACTION="[URL=http://www.???/reg.cgi>]http://www.???/reg.cgi">[/URL]
     <tr>
       <td width="38%"><strong>Your Name:</strong></td>
       <td width="62%"><strong>
<input name=150 type=TEXT id="150" value="Name" size=40>
         </strong></td>
     </tr>
     <tr>
       <td><strong>Your Mail:</strong></td>
       <td><strong>
<input name=152 type=TEXT id="152" value="mail@mail" size=40>
         </strong></td>
     </tr>
     <tr>
       <td><strong>Your Version:</strong></td>
       <td><strong>
         <input name=151 type=TEXT id="151" size=40>
         </strong></td>
     </tr>
     <tr>
       <td><strong>Your Country:</strong></td>
       <td><strong>
<input name=1100 type=TEXT id="1100" size=40>
         </strong></td>
     </tr>
     <tr>
       <td colspan="2"><div align="center"><br>
           <br>
           <INPUT name="image" TYPE=image SRC="add.gif" width="72" height="21" BORDER=no>
         </div></td>
     </tr>
   </form>
 </table>
 <br>
 <br>
</div>
</body>
</html>
\n\n

<!--EDIT|Alex556|1108495284-->

View full thread Warum beschreibt er TXT Datei nicht?: TXT Datei aber neue Zeit